package utils;

public class Interval {
	private double x;
	private double y;
	
	public Interval() {
		x = 0.0;
		y = 0.0;
	}
	
	public Interval(double x, double y) {
		this.x = x;
		this.y = y;
	}
	
	public String toString() {
		return "[" + x +"," + y +"]";
	}
	
	public Double toDouble() {
		if (x != y) {
			throw new UnsupportedOperationException("It is not possible");
		}
		return x;
	}
	
	// Setters and getters
	public void setX(double x) {
		this.x = x;
	}
	
	public void setY(double y) {
		this.y = y;
	}
	
	public void setInterval(double x, double y) {
		this.x = x;
		this.y = y;
	}
	
	public double getX() {
		return x;
	}
	
	public double getY() {
		return y;
	}
}
